SET NOCOUNT ON
---------------------------------------- Database and settings ----------------------------------------
-- Check whether you have granted "Lock Pages in Memory" SQL Server service account
USE master
GO
WHILE @@TRANCOUNT>0 ROLLBACK
GO
BEGIN TRY DROP DATABASE BigLink END TRY BEGIN CATCH END CATCH
GO
IF NOT EXISTS(SELECT Name FROM sys.databases WHERE Name='BigLink') 
	CREATE DATABASE BigLink -- DROP DATABASE BigLink
		ON PRIMARY (NAME='BigLink',FILENAME='f:\Data\BigLink.mdf',SIZE=10MB,FILEGROWTH=10%)
		LOG ON(NAME='BigLink_log',FILENAME='f:\Data\BigLink.ldf',SIZE=2MB,FILEGROWTH=10%)
GO
ALTER DATABASE BigLink SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE BigLink SET TRUSTWORTHY ON
GO
USE BigLink
GO
IF EXISTS (SELECT value FROM sys.configurations WHERE name='xp_cmdshell' AND value=0)
	EXEC ('EXEC sp_configure ''show advanced options'',1;RECONFIGURE;EXEC sp_configure ''xp_cmdshell'',1;RECONFIGURE')
GO
---------------------------------------- Utilities ----------------------------------------
BEGIN TRY DROP PROC Ex END TRY BEGIN CATCH END CATCH
GO
CREATE PROC Ex @ignoreError BIT,@print BIT,@c0 NVARCHAR(MAX),@c1 NVARCHAR(MAX)=NULL,@c2 NVARCHAR(MAX)=NULL,@c3 NVARCHAR(MAX)=NULL,@c4 NVARCHAR(MAX)=NULL,@c5 NVARCHAR(MAX)=NULL,@c6 NVARCHAR(MAX)=NULL,@c7 NVARCHAR(MAX)=NULL,@c8 NVARCHAR(MAX)=NULL,@c9 NVARCHAR(MAX)=NULL AS
	DECLARE @cmd NVARCHAR(MAX)=@c0+ISNULL(@c1,'')+ISNULL(@c2,'')+ISNULL(@c3,'')+ISNULL(@c4,'')+ISNULL(@c5,'')+ISNULL(@c6,'')+ISNULL(@c7,'')+ISNULL(@c8,'')+ISNULL(@c9,'')
	IF @print=1 PRINT '-- '+@cmd
	IF @ignoreError=0 EXEC sp_executesql @cmd
	ELSE
		BEGIN TRY EXEC (@cmd) END TRY 
		BEGIN CATCH IF @print=1 PRINT '-- -- !ok' END CATCH
	IF @print=1 PRINT '-- Eo '+@cmd
GO
EXEC Ex 1,0,'DROP TABLE cmd'
EXEC Ex 1,0,'DROP TABLE cmds'
EXEC Ex 1,0,'DROP PROC ExCmd'
EXEC Ex 1,0,'DROP TABLE setting'
EXEC Ex 1,0,'DROP PROC SetSetting'
EXEC Ex 1,0,'DROP FUNCTION Get'
EXEC Ex 0,0,'CREATE TABLE setting(PK BIGINT IDENTITY(1,1),name NVARCHAR(4000),value NVARCHAR(MAX))'
EXEC Ex 0,0,'CREATE PROC SetSetting @name NVARCHAR(4000),@value NVARCHAR(MAX) AS UPDATE setting SET value=@value WHERE name=@name; IF @@ROWCOUNT=0 INSERT setting VALUES (@name,@value)'
EXEC Ex 0,0,'CREATE FUNCTION Get(@name NVARCHAR(4000)) RETURNS NVARCHAR(MAX) AS BEGIN RETURN (SELECT value FROM setting WHERE name=@name) END'
EXEC Ex 0,0,'CREATE TABLE cmd(PK BIGINT IDENTITY(1,1),output NVARCHAR(4000))'
EXEC Ex 0,0,'CREATE TABLE cmds(PK BIGINT IDENTITY(1,1),comment NVARCHAR(4000),cmd NVARCHAR(4000),FK BIGINT,output NVARCHAR(4000),dt DATETIME)'
EXEC Ex 0,0,'CREATE PROC ExCmd @comment NVARCHAR(4000), @cmd NVARCHAR(4000) AS TRUNCATE TABLE cmd; INSERT cmd EXEC xp_cmdshell @cmd; INSERT cmds SELECT @comment,@cmd,*,GETDATE() FROM cmd WHERE output IS NOT NULL'
GO
---------------------------------------- CLR ----------------------------------------
IF EXISTS (SELECT value FROM sys.configurations WHERE name='clr enabled' AND value=0)
	EXEC ('EXEC sp_configure ''show advanced options'',1;RECONFIGURE;EXEC sp_configure ''clr enabled'',1;RECONFIGURE')
EXEC Ex 1,0,'CREATE ASSEMBLY XmlAsRelationalTvf FROM 
	0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C010300E3C8D74D0000000000000000E00002210B0108000060000000060000000000001E7E000000200000008000000000400000200000000200000400000000000000040000000000000000C0000000020000BEAB0000030040850000100000100000000010000010000000000000100000000000000000000000C47D00005700000000800000D00300000000000000000000000000000000000000A000000C0000002C7D00001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000245E0000002000000060000000020000000000000000000000000000200000602E72737263000000D0030000008000000004000000620000000000000000000000000000400000402E72656C6F6300000C00000000A0000000020000006600000000000000000000000000004000004200000000000000000000000000000000007E0000000000004800000002000500BC4800007034000009000000000000000000000000000000502000008000000000000000000000000000000000000000000000000000000000000000000000004D7ABDD87FB42DE8BF320C94BDD94427824C242A4758E71C21DB72A1F8B92BDA3DCFFFB9972C49A0261CDFAD4D251E2E462C720154EB860CCBE6AD2918B87BE907FE6FB60E61EB053D7BE705CE07A5DE25D1338851D30C5858F7BA08C85AEE97CA54F8ADA7F5FACF010ABD432F1D9923738C9D04989DBD9C98088A375F903E085A0203041717200040000020000001006A28020000062A00133008001E000000030000110304166A021F20731A0000060A020304050E040E050E060628030000062A00001B3008001803000004000011027B360000040B07162E0C07193BEA01000038F402000002157D3600000402027B3A0000048D200000017D3D00000402027B37000004280C0000067D3E00000438B602000002027B3E0000046F1700000A74210000017D3F000004027B3C000004027B3C0000047C070000047B01000004027B3F0000046F1800000602027B38000004027B39000004027B3F000004027B3B000004027B3A000004732F0000067D4000000402167D4100000402731800000A7D4200000402027B3F0000041917191E2000000008731900000A14166A17027B420000041616281A00000A7D4300000402177D3600000402027B400000047B250000047D4400000438D301000002027B40000004027B440000046F310000067D4500000402027B43000004027B44000004027B45000004176F1B00000A7D4600000402187D3600000402166A7D47000004384E01000002027B40000004027B45000004027B470000046F320000067D48000004027B46000004027B47000004027B3D00000416027B480000046F0100002B2602167D4900000402027B3C000004027C3D000004027C49000004027B480000046F190000067D4100000438BE000000027B3C0000047C07000004027B44000004027B4700000458027B490000046A587D0500000402027B3C0000047B070000048C030000027D3500000402197D36000004170ADD1A01000002187D36000004027B3C0000047C07000004027B3C0000047C070000047B01000004176A58281500000602027B3C000004027C3D000004027C49000004027B480000046F190000067D41000004027B44000004027B4700000458027B400000047B26000004320E027B40000004177D2B0000042B0C027B410000041B3B36FFFFFF02257B47000004027B400000047B2A0000046A587D47000004027B47000004027B450000042F10027B400000047B2B0000043994FEFFFF02283C00000602257B44000004027B400000047B29000004587D44000004027B44000004027B400000047B280000042F10027B400000047B2B000004390AFEFFFF02283B000006027B3E0000046F1300000A3A3AFDFFFF160ADE07022838000006DC062A411C000004000000000000000F0300000F03000007000000000000001E027B350000042A1A731E00000A7A001B3002004800000005000011027B360000040A06175945030000000100000001000000010000002A027B360000040B071859450200000002000000020000002B09DE0702283C000006DCDE0702283B000006DC2A011C000002003500023700070000000002001C0024400007000000001E027B350000042A3A02281F00000A02037D360000042A6E02157D36000004027B430000042C0B027B430000046F1600000A2A6E02177D36000004027B460000042C0B027B460000046F1600000A2A0013300200370000000600001116733A0000060A06027D3700000406057D38000004060E047D39000004060E057D3A000004060E067D3B000004060E077D3C000004062A00133003003E0000000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A512A0000133003004F0000000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A510E0612007B02000004179A6F2000000A512A0013300300710000000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A510E0612007B02000004179A6F2000000A510E0712007B02000004189A6F2000000A510E0812007B02000004199A6F2000000A512A00000013300300B50000000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A510E0612007B02000004179A6F2000000A510E0712007B02000004189A6F2000000A510E0812007B02000004199A6F2000000A510E0912007B020000041A9A6F2000000A510E0A12007B020000041B9A6F2000000A510E0B12007B020000041C9A6F2000000A510E0C12007B020000041D9A6F2000000A512A00000013300300440100000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A510E0612007B02000004179A6F2000000A510E0712007B02000004189A6F2000000A510E0812007B02000004199A6F2000000A510E0912007B020000041A9A6F2000000A510E0A12007B020000041B9A6F2000000A510E0B12007B020000041C9A6F2000000A510E0C12007B020000041D9A6F2000000A510E0D12007B020000041E9A6F2000000A510E0E12007B020000041F099A6F2000000A510E0F12007B020000041F0A9A6F2000000A510E1012007B020000041F0B9A6F2000000A510E1112007B020000041F0C9A6F2000000A510E1212007B020000041F0D9A6F2000000A510E1312007B020000041F0E9A6F2000000A510E1412007B020000041F0F9A6F2000000A512A13300300640200000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A510E0612007B02000004179A6F2000000A510E0712007B02000004189A6F2000000A510E0812007B02000004199A6F2000000A510E0912007B020000041A9A6F2000000A510E0A12007B020000041B9A6F2000000A510E0B12007B020000041C9A6F2000000A510E0C12007B020000041D9A6F2000000A510E0D12007B020000041E9A6F2000000A510E0E12007B020000041F099A6F2000000A510E0F12007B020000041F0A9A6F2000000A510E1012007B020000041F0B9A6F2000000A510E1112007B020000041F0C9A6F2000000A510E1212007B020000041F0D9A6F2000000A510E1312007B020000041F0E9A6F2000000A510E1412007B020000041F0F9A6F2000000A510E1512007B020000041F109A6F2000000A510E1612007B020000041F119A6F2000000A510E1712007B020000041F129A6F2000000A510E1812007B020000041F139A6F2000000A510E1912007B020000041F149A6F2000000A510E1A12007B020000041F159A6F2000000A510E1B12007B020000041F169A6F2000000A510E1C12007B020000041F179A6F2000000A510E1D12007B020000041F189A6F2000000A510E1E12007B020000041F199A6F2000000A510E1F12007B020000041F1A9A6F2000000A510E2012007B020000041F1B9A6F2000000A510E2112007B020000041F1C9A6F2000000A510E2212007B020000041F1D9A6F2000000A510E2312007B020000041F1E9A6F2000000A510E2412007B020000041F1F9A6F2000000A512A13300300A40400000700001102A5030000020A0312007B01000004550412007B03000004510512007B06000004550E0412007B05000004550E0512007B02000004169A6F2000000A510E0612007B02000004179A6F2000000A510E0712007B02000004189A6F2000000A510E0812007B02000004199A6F2000000A510E0912007B020000041A9A6F2000000A510E0A12007B020000041B9A6F2000000A510E0B12007B020000041C9A6F2000000A510E0C12007B020000041D9A6F2000000A510E0D12007B020000041E9A6F2000000A510E0E12007B020000041F099A6F2000000A510E0F12007B020000041F0A9A6F2000000A510E1012007B020000041F0B9A6F2000000A510E1112007B020000041F0C9A6F2000000A510E1212007B020000041F0D9A6F2000000A510E1312007B020000041F0E9A6F2000000A510E1412007B020000041F0F9A6F2000000A510E1512007B020000041F109A6F2000000A510E1612007B020000041F119A6F2000000A510E1712007B020000041F129A6F2000000A510E1812007B020000041F139A6F2000000A510E1912007B020000041F149A6F2000000A510E1A12007B020000041F159A6F2000000A510E1B12007B020000041F169A6F2000000A510E1C12007B020000041F179A6F2000000A510E1D12007B020000041F189A6F2000000A510E1E12007B020000041F199A6F2000000A510E1F12007B020000041F1A9A6F2000000A510E2012007B020000041F1B9A6F2000000A510E2112007B020000041F1C9A6F2000000A510E2212007B020000041F1D9A6F2000000A510E2312007B020000041F1E9A6F2000000A510E2412007B020000041F1F9A6F2000000A510E2512007B020000041F209A6F2000000A510E2612007B020000041F219A6F2000000A510E2712007B020000041F229A6F2000000A510E2812007B020000041F239A6F2000000A510E2912007B020000041F249A6F2000000A510E2A12007B020000041F259A6F2000000A510E2B12007B020000041F269A6F2000000A510E2C12007B020000041F279A6F2000000A510E2D12007B020000041F289A6F2000000A510E2E12007B020000041F299A6F2000000A510E2F12007B020000041F2A9A6F2000000A510E3012007B020000041F2B9A6F2000000A510E3112007B020000041F2C9A6F2000000A510E3212007B020000041F2D9A6F2000000A510E3312007B020000041F2E9A6F2000000A510E3412007B020000041F2F9A6F2000000A510E3512007B020000041F309A6F2000000A510E3612007B020000041F319A6F2000000A510E3712007B020000041F329A6F2000000A510E3812007B020000041F339A6F2000000A510E3912007B020000041F349A6F2000000A510E3A12007B020000041F359A6F2000000A510E3B12007B020000041F369A6F2000000A510E3C12007B020000041F379A6F2000000A510E3D12007B020000041F389A6F2000000A510E3E12007B020000041F399A6F2000000A510E3F12007B020000041F3A9A6F2000000A510E4012007B020000041F3B9A6F2000000A510E4112007B020000041F3C9A6F2000000A510E4212007B020000041F3D9A6F2000000A510E4312007B020000041F3E9A6F2000000A510E4412007B020000041F3F9A6F2000000A512A1B3005007301000004000011027B4B0000040B074503000000050000004D01000022010000384801000002157D4B00000402167D4D000004027B4C0000046F2100000A183168027B4C000004027B4C0000046F2100000A17596F2200000A282300000A1F533347027B4C000004027B4C0000046F2100000A18596F2200000A1F2F332B02027B4C00000416027B4C0000046F2100000A18596F2400000A6F2500000A7D4C00000402177D4D00000402027B4C000004282600000A7D4E00000402027B4C0000047D4F00000402027B4F00000416027B4E0000046F2100000A17586F2700000A7D4F00000402177D4B00000402027B4E000004027B4F000004027B4D0000042D03162B0117282800000A7D5100000402167D520000042B3F02027B51000004027B520000049A7D5000000402027B500000047D4A00000402187D4B000004170ADE3602177D4B00000402027B5200000417587D52000004027B52000004027B510000048E6932B1022843000006160ADE07022840000006DC062A00411C000004000000000000006A0100006A01000007000000000000001E027B4A0000042A1A731E00000A7A00133002001F00000008000011027B4B0000040A061759450200000001000000010000002A0228430000062A1E027B4A0000042A3A02281F00000A02037D4B0000042A2202157D4B0000042A001330020010000000090000111673420000060A06027D4C000004062A1B300300DC00000004000011027B540000040B07450300000005000000B60000007E00000038B100000002157D5400000402177D5400000402027B5500000472010000706F2900000A6F2A00000A7D5800000402167D590000042B6902027B58000004027B590000049A7D5600000402027B560000046F2500000A280B0000067D570000042B2302027B570000046F1700000A7D5300000402187D54000004170ADE4302177D54000004027B570000046F1300000A2DD002027B5900000417587D59000004027B59000004027B580000048E69328702284A000006160ADE07022847000006DC062A0110000004000000D3D30007000000001E027B530000042A1A731E00000A7A00133002001F00000008000011027B540000040A061759450200000001000000010000002A02284A0000062A1E027B530000042A3A02281F00000A02037D540000042A2202157D540000042A0013300200100000000A0000111673490000060A06027D55000004062A133004003C0000000B000011026F2100000A8D200000010A160B2B0F060702076F2200000AD29C0717580B07026F2100000A32E8282B00000A066F2C00000A0C0816282D00000A2A2E7205000070732E00000A2A1B3005008702000004000011027B5B0000040B0745050000000500000059020000590200009B01000052020000385402000002157D5B000004027C60000004176A7D2D000004027C60000004732F00000A7D2E00000402027B5D0000047D6100000402027B5C000004733000000A283100000A7D62000004027B62000004027B5D000004027B5E000004583121027B5E000004027B5D000004311302027B5D000004027B5E000004587D6200000402027B5C000004283200000A7D6300000402177D5B00000402027B61000004027B5F000004587D64000004385B010000027B64000004027B62000004312902257B5F000004027B62000004027B6400000458176A59597D5F00000402027B620000047D6400000402027B63000004027B61000004027B64000004027B6100000459176A586F3300000A7D6500000402187D5B00000402166A7D6700000438B3000000027B65000004027B67000004027C660000046F0200002B027B660000041F203217027C600000047B2E000004027B660000046F3500000A26027B660000041F0D2E17027C600000047B2E0000046F3600000A20A00F0000334B02027B600000048C0B0000027D5A00000402197D5B000004170ADDC900000002187D5B000004027C600000047B2E000004166F3700000A027C60000004257B2D000004176A587D2D00000402257B67000004176A587D67000004027B67000004027B5F0000043F3CFFFFFF02285200000602027B640000047D6100000402257B64000004027B5F000004587D64000004027B61000004027B620000043F94FEFFFF022851000006027C600000047B2E0000046F3600000A16312302027B600000048C0B0000027D5A000004021A7D5B000004170ADE1202157D5B000004160ADE0702284E000006DC062A00411C000004000000000000007E0200007E02000007000000000000001E027B5A0000042A1A731E00000A7A001B3002004800000005000011027B5B0000040A06175945030000000100000001000000010000002A027B5B0000040B071859450200000002000000020000002B09DE07022852000006DCDE07022851000006DC2A011C000002003500023700070000000002001C0024400007000000001E027B5A0000042A3A02281F00000A02037D5B0000042A6E02157D5B000004027B630000042C0B027B630000046F1600000A2A6E02177D5B000004027B650000042C0B027B650000046F1600000A2A0013300200250000000C0000111673500000060A06027D5C00000406037D5D00000406047D5E00000406057D5F000004062A000000133002001F0000000D00001102A50B0000020A0312007B2D000004550412007B2E0000046F2000000A512A001B3004009602000004000011027B690000040B07162E0C07193BF4010000387202000002157D69000004022100000000000100007D6C00000402167D6E000004027C6F0000047211000070027B6B0000047215000070283800000A7333000006810C000002027C700000047219000070027B6B0000047215000070283800000A7333000006810C000002027C6D000004176A7D2D000004027C6D000004732F00000A7D2E00000402027B6A000004733000000A283100000A7D7100000402027B6A000004283200000A7D7200000402177D6900000402166A7D73000004389C01000002027B6C0000047D74000004027B74000004027B73000004027B7100000458311302027B71000004027B73000004597D7400000402027B72000004027B73000004027B740000046F3300000A7D7500000402187D6900000402166A7D77000004380D010000027B75000004027B77000004027C760000046F0200002B027B6E0000042D22027C6F000004027B76000004283400000639C900000002177D6E00000438BD000000027C70000004027B7600000428340000062D1C027C6D0000047B2E000004027B760000046F3500000A26388E000000027C6D0000047B2E000004027C6D0000047B2E0000046F3600000A027C700000047B30000004175959027C700000047B3000000417596F3900000A2602027B6D0000048C0B0000027D6800000402197D69000004170ADD8E00000002187D69000004027C6D000004257B2D000004176A587D2D000004027C6D0000047B2E000004166F3700000A02167D6E00000402257B77000004176A587D77000004027B77000004027B740000043FE2FEFFFF02285A00000602257B73000004027B6C000004587D73000004027B73000004027B710000043F53FEFFFF022859000006160ADE07022856000006DC062A0000411C000004000000000000008D0200008D02000007000000000000001E027B680000042A1A731E00000A7A001B3002004800000005000011027B690000040A06175945030000000100000001000000010000002A027B690000040B071859450200000002000000020000002B09DE0702285A000006DCDE07022859000006DC2A011C000002003500023700070000000002001C0024400007000000001E027B680000042A3A02281F00000A02037D690000042A6E02157D69000004027B720000042C0B027B720000046F1600000A2A6E02177D69000004027B750000042C0B027B750000046F1600000A2A0013300200170000000E0000111673580000060A06027D6A00000406037D6B000004062A1E02281F00000A2A0013300300590000000800001102037D0100000402057D0400000402027B040000048D060000017D02000004160A2B11027B0200000406732F00000AA20617580A06027B0400000432E602047D0300000402166A7D050000040204280D0000067D060000042A00000013300200280000000800001102156A7D05000004160A2B12027B02000004069A166F3700000A0617580A06027B0400000432E52A3A02037D010000040228140000062A6E02047D030000040204280D0000067D06000004020328150000062AA202281F00000A02167D0800000402057D09000004020304027B0900000473130000067D070000042A3A027C07000004030428160000062A0A162A000013300400E00000000F000011027C13000004FE1507000002021F207D1A000004021F207D1B00000402050E040E05281700000602167D12000004020373240000067D1300000402027B090000048D070000027D1400000404178D210000010C08167201000070A208176F3B00000A0D1613042B650911049A0A066F2500000A0B076F2100000A16314A027B1400000402257B0800000425130517587D0800000411058F070000020673240000068107000002027B080000040E053117721F0000700F05283C00000A283D00000A733E00000A7A1104175813041104098E69329402732C0000067D150000042A133003003200000008000011020304281800000602167D12000004160A2B15027B14000004068F0700000228260000060617580A06027B0800000432E22A000013300600C900000010000011027B120000041B40A50000000216281D0000063899000000027B120000040A06450600000002000000130000002A0000004100000058000000740000002B6702030405027C12000004281E0000062B6102030405027C15000004027C1200000428200000062B4A02030405027C15000004027C1200000428210000062B3302030405027C15000004027C1200000428220000062B1C02030405027C1200000428230000062B0B724B000070733F00000A7A027B120000041B2E08044A053F56FFFFFF027B120000042A000000133002008F00000010000011030A0645060000000200000016000000380000004200000067000000670000002B65027C13000004282600000602167D160000042B51027B150000046F2900000602167D1700000402167D1800000402167D190000042B2F021F207D1A0000042B25027C070000047B02000004027B150000047B240000049A166F3700000A021F207D1B00000402037D120000042A001330050048000000080000112B3B027C13000004035004254A250A1758540691027C1600000428270000062C1C027B160000042C0D027C1300000428260000062B070217281D000006044A052F050E044A2CBB2A133003008F000000110000110350157D24000004160A2B62027B14000004068F070000027B1C0000048E6903507B220000043342170B160C2B24027B14000004068F070000027B1C000004089103507B2100000408912E02160B0817580C072C0A0803507B2200000432CF072C080350067D240000040617580A03507B2400000415330906027B08000004328B03507B2400000416FE0416FE012A00033004008E000000000000002B3502027C130000040350044A9128280000067D18000004020E04500350044A91027C190000046F2A0000067D1700000404254A175854027B170000042D0D027B180000042D05044A0532B6027B180000042C08021B281D0000062A027B170000042C29027B190000042C080217281D0000062A020E04281F0000062C080219281D0000062A0218281D0000062A00001330040038000000120000112B2A035004254A250B17585407910A027B1A0000041F3C330C061F2F3307021A281D00000602067D1A0000040E054A183305044A0532CB2A133004008D000000120000112B7C035004254A250B17585407910A061F3C330A027B1B0000041F3C3359027B1B0000041F3C330E061F2F3309021A281D0000062B41027B1B0000041F3C331C027C070000047B020000040E04507B240000049A1F3C6F3500000A26027C070000047B020000040E04507B240000049A066F3500000A2602067D1B0000040E054A193308044A053F76FFFFFF2A0000001330040025000000080000112B17035004254A250A17585406911F3E33070217281D0000060E044A1A3305044A0532DE2A000000133004002E0000000800001102147D1C000004020215250A7D1E000004067D1D000004021FFE7D1F00000402167D20000004020328250000062A0000133004006700000008000011036F2100000A2000010000310D0320000100006F4000000A1001027B1D000004036F2100000A2E1D02036F2100000A7D1D00000402027B1D0000048D200000017D1C000004160A2B14027B1C0000040603066F2200000AD29C0617580A06036F2100000A32E32A5E02157D1E000004021FFE7D1F00000402167D200000042A00133003009700000013000011160A027B1E000004153318031F3C408200000002257B1E00000417587D1E0000042B72027B1E000004027B1D0000042F2903027B1C000004027B1E00000491331002257B1E00000417587D1E0000042B4402157D1E0000042B3B031F2F330C02177D200000040417522B2A031F20330902177D200000042B1C031F3E330B02157D1E000004170A2B0C031F3C330702167D1E000004062A00133003009200000013000011160A027B1F0000041FFE3315031F3C337F02257B1F00000417587D1F0000042B6F027B1F00000415331F031F2F331002257B1F00000417587D1F0000042B51021FFE7D1F0000042B47027B1F000004027B1D0000042F2A03027B1C000004027B1F00000491331002257B1F00000417587D1F0000042B19021FFE7D1F0000042B0F021FFE7D1F000004031F3E3302170A062A5A02157D2400000402157D2200000402167D230000042A000000133004008600000004000011160A027B22000004153315031F3C337402257B2200000417587D220000042B64031F2F330C04175202177D230000042B53031F3E3304170A2B4A031F3C330902167D220000042B3C031F202E0D027B220000042000010000320902177D230000042B21027B230000042D19027B2100000402257B22000004250B17587D2200000407039C062A0000133003004200000014000011027B22000004153306726F0000702A027B22000004734100000A0A160B2B1306027B2100000407916F3500000A260717580B07027B2200000432E4066F2000000A2A960220000100008D200000017D2100000402157D2200000402157D2400000402281F00000A2A3A020304050E040E05281A0000062A00133005006702000015000011027B120000041B40430200000216281D0000063837020000027B120000041307110745060000000500000056000000E60000002A010000F5010000100200003800020000160B2B38027C130000040304254C251308176A585511086F4200000A120128270000062C17072C0D027C1300000428260000062B070217281D000006044C053CC7010000027B120000042CB838BA010000160C160D1613042B31027C1300000403044C6F4200000A28280000060D027B1500000403044C6F4200000A12046F2A0000060C04254C176A5855082D08092D05044C0532C4092C0C021B281D000006386601000008396001000011042C0C0217281D000006385001000002027C15000004281F0000062C0C0219281D00000638360100000218281D000006382A0100001F200A2B290304254C251309176A585511096F4200000A1305061F3C330D11051F2F3307021A281D00000611050A027B120000041840F0000000044C0532C638E6000000027C070000047B02000004027B150000047B240000049A166F3700000A1F200A2B790304254C25130A176A5855110A6F4200000A130611061F3C3305061F3C3357061F3C330F11061F2F3309021A281D0000062B43061F3C331F027C070000047B02000004027B150000047B240000049A1F3C6F3500000A26027C070000047B02000004027B150000047B240000049A11066F3500000A2611060A027B12000004193342044C053F76FFFFFF2B380304254C25130B176A5855110B6F4200000A1F3E33070217281D000006027B120000041A3312044C0532D52B0B724B000070733F00000A7A027B120000041B2E08044C053FB8FDFFFF027B120000042A00033004006C0000000000000002281F00000A0205733000000A283100000A7D2800000402167D2B000004020317597D2C0000040202027B2C0000040428300000067D250000040202030428300000067D2600000402027B26000004027B25000004597D27000004020E047D29000004020E057D2A0000042A9E0304310B727F000070733E00000A7A03043307027B280000042A036A027B280000045A046A5B2A133002001D00000016000011027B290000040A030658027B280000043109027B2800000403590A062A000000133002001500000008000011027B2A0000040A04066A58033105030459690A062A00000013300400460000000800001102167D3100000402036F2100000A7D3000000402027B300000048D200000017D2F000004160A2B14027B2F0000040603066F2200000AD29C0617580A06027B3000000432E32A0000133003003F00000004000011160A03027B2F000004027B31000004912E0902167D310000042B2202257B310000041758250B7D3100000407027B300000043309170A02167D31000004062A0042534A4201000100000000000C00000076342E302E33303331390000000005006C000000E8180000237E000054190000C413000023537472696E677300000000182D0000A800000023555300C02D0000100000002347554944000000D02D0000A006000023426C6F620000000000000002000001575FA20B090A000000FA253300160000010000003B00000012000000770000005A000000110100000F0000004400000009000000AA0000000100000016000000050000000A0000000A00000019000000010000000100000003000000100000000200000000000A000100000000000600C300BC000600CA00BC000600D400BC000600EC00D9000A00D801C3010600310225020E000905ED040600640645060A00BD06A2060600EE09DC090600050ADC090600220ADC090600410ADC0906005A0ADC090600730ADC0906008E0ADC090600A90ADC090600C20A45060600D60ADC090600090BEF0A06003E0B220B06005A0B220B06007C0B690B5F00900B00000600BF0B9F0B0600DF0B9F0B0A00100CA2060600540C390C0600620CBC000E00980DED040E00D00DED040600DD0EBC000600E20EBC000600F30EE90E0600FE0EE90E0600070FE90E0600120FE90E06001C0FE90E0E00280FED040E003F0FE90E0600760FE90E0600980F690B0600B00FBC0006005910BC0006007510E90E06009210E90E06009C10E90E06003C111F11060047111F1106006111BC0006000F12E90E06001A13450606003013450606003B13BC0006004E13BC0006005413BC0006005E13BC0006007F139F0B0600AA139A13000000000100000000000100010001001000210000000500010001000C01100025000000090001001300040010002F00000005000700170002010000340000000D000A001A000400100042000000100011001A000C0110004900000009001C00240004001000590000000500210029000300100064000000180025002D000200100074000000050025002F000A0110008500000009002D0033000A0110009200000009002F00330002010000A00000000D003200350003011000250C000005003500350003011000C60F000005004A003D0003011000B2100000050053004400030110007611000005005A004B00030110002F12000005006800530006002202B30106003F02B60106004202BB0106004B02BE0106005A02B30106006702B30106007A02D30104008402BE0104004B02BE0106069A02BE015680A202E2015680B802E2015680C902E2015680DA02E2015680EB02E20156800203E20156801103BE0104002403E20104002E030902040036030D0204003E0312020100560325020100980325020100AD0325020100C80325020100F5034C02010011044C0206003E044F0206004A04BE0106005604BE0106006104BE0106006F0425020600A8044F0206004A04BE010600B30425020600C104BE0106002205B30106002D05B30106003805B30106004405B30106004D05B30106005D05BE0106006A05250201007805BE010600B705B3010600BA058C020600C4054F020600CB05BE010600D105BE0106069A02BE015680D80590025680E20590020100770C960301001A0DBE010600EA05BB0106000506BE0106000C06BE0106001806BE0106002406B30106003306A2030600500D4F020600590DA6030600650DBB0106006E0DAA030600850DE2010600B10DAE030600E10DB2030600EB0DB3010600FF0DB3010600180EB6030600270EB30106003D0EBE0106004E0EBE010100770C960301001A0DBE010600C708BB010600E00F25020600F00FBB010600FD0FBB0106000C10BB0106002C10100406003810BE010100770C960301001A0DBE010600EA05BB010600CE10BB010600DD10A6030600F510100406000111BE010100770C960301001A0DBE010600D008BB010600D308B3010600DA08B3010600E108B30106008911970406009411B3010600A711B3010600B311B2030600BE11B3010600CF11B6030600DF119B040600E811B3010100770C960301001A0DBE010600D008BB010600F208BB0106004B12B30106005E12970406006912900206007612C80406008412C80406009012B3010600A112B2030600AC12B3010600BC12B3010600D312B6030600E3129B040600EC12B301D020000000009600F8000A000100E820000000009600030112000400242500000000940014011E000B00682500000000960022012C001300B42500000000960030013B00190010260000000096003E014C00200090260000000096004C016100290054270000000096005A017E003600A4280000000096006901AB004B00142B0000000096007801F8007000BC3100000000960087018601B5002C330000000096009A018601B6004833000000009600AF018C01B7009033000000009600E2019101B8001C37000000009600EA019601B8005037000000009600F6019F01BC000C3B0000000096000702A801BF002F3B0000000086181C02AF01C100383B0000000086181C02C101C100A03B0000000086007402AF01C400D43B0000000086007402C801C400E33B0000000086007402CD01C500FF3B0000000086181C02C101C700283C00000000C6017402CD01CA00373C00000000C6019102D701CC003C3C0000000086181C021602CF00283D00000000C6007402CD01D400683D00000000C6009102D701D600403E00000000840049031F02D900DC3E00000000840073032802DA00303F00000000840083033502DE00CC3F000000008400EA033C02DF00684000000000840006043C02E400AC4000000000840022043C02E90048410000000084002D042802EE007C410000000086181C025302F200B8410000000086007C045302F3002B420000000086008304AF01F40044420000000086008E045802F400E8420000000086009C045F02F60086430000000086008304AF01F700A043000000008600CB045802F700344400000000C600D8046402F90082440000000086181C02AF01F900A8440000000086181C021602F900B84400000000860091026802FE002C470000000086181C0272020101A44700000000840085057B020601CC47000000008600980581020801F847000000008600A905860209011C480000000086181C0253020B017048000000008600BE055F020C01142100000000E1016E0C92030D01542400000000E109840C99030D015C2400000000E101D20CAF010D01642400000000E101F70CAF010D01D42400000000E109250D99030D01DC240000000086181C02B8020D01EB240000000081005C0EAF010E0107250000000081006A0EAF010E01C42F00000000E1016E0C92030E01603100000000E109840C99030E01683100000000E101D20CAF010E01703100000000E101F70CAF010E019B3100000000E109250D99030E01A3310000000086181C02B8020E01B2310000000081001D10AF010F01D83100000000E1016E0C92030F01D03200000000E109840C99030F01D83200000000E101D20CAF010F01E03200000000E101F70CAF010F010B3300000000E109250D99030F0113330000000086181C02B8020F012233000000008100E610AF0110019C3300000000E1016E0C920310014C3600000000E109840C99031001543600000000E101D20CAF0110015C3600000000E101F70CAF011001CC3600000000E109250D99031001D4360000000086181C02B8021001E336000000008100F111AF011101FF360000000081000012AF0111017C3700000000E1016E0C920311013C3A00000000E109840C99031101443A00000000E101D20CAF0111014C3A00000000E101F70CAF011101BC3A00000000E109250D99031101C43A0000000086181C02B8021101D33A000000008100F512AF011201EF3A0000000081000413AF01120100000100EA0500000200F30500000300FA0500000100EA0500000200F30500000300FA05000004000506000005000C0600000600180600000700240600000100EA0500000200F30500000300FA05000004000506000005000C06000006001806000007002406000008003306000001003806020002004006020003007106020004007C06020005008B06020006009A06000001003806020002004006020003007106020004007C06020005008B06020006009A0602000700CF06000001003806020002004006020003007106020004007C06020005008B06020006009A0602000700CF0602000800D70602000900DF06000001003806020002004006020003007106020004007C06020005008B06020006009A0602000700CF0602000800D70602000900DF0602000A00E70602000B00EF0602000C00F70602000D00FF06000001003806020002004006020003007106020004007C06020005008B06020006009A0602000700CF0602000800D70602000900DF0602000A00E70602000B00EF0602000C00F70602000D00FF0602000E00070702000F000F07020010001707020011001F07020012002707020013002F07020014003707020015003F07000001003806020002004006020003007106020004007C06020005008B06020006009A0602000700CF0602000800D70602000900DF0602000A00E70602000B00EF0602000C00F70602000D00FF0602000E00070702000F000F07020010001707020011001F07020012002707020013002F07020014003707020015003F07020016004707020017004F07020018005707020019005F0702001A00670702001B006F0702001C00770702001D007F0702001E00870702001F008F07020020009707020021009F0702002200A70702002300AF0702002400B70702002500BF07000001003806020002004006020003007106020004007C06020005008B06020006009A0602000700CF0602000800D70602000900DF0602000A00E70602000B00EF0602000C00F70602000D00FF0602000E00070702000F000F07020010001707020011001F07020012002707020013002F07020014003707020015003F07020016004707020017004F07020018005707020019005F0702001A00670702001B006F0702001C00770702001D007F0702001E00870702001F008F07020020009707020021009F0702002200A70702002300AF0702002400B70702002500BF0702002600C70702002700CF0702002800D70702002900DF0702002A00E70702002B00EF0702002C00F70702002D00FF0702002E00070802002F000F08020030001708020031001F08020032002708020033002F08020034003708020035003F08020036004708020037004F08020038005708020039005F0802003A00670802003B006F0802003C00770802003D007F0802003E00870802003F008F08020040009708020041009F0802004200A70802004300AF0802004400B70802004500BF0800000100C70800000100EA0500000100CE0800000100D00800000200D30800000300DA0800000400E10800000100EE0802000200B70502000300BA0500000100D00800000200F20800000100F60800000200FA0800000300040900000100F60800000100F60800000200FA0800000100B70500000200140900000300040900000100B705000002001409000001001D09000002002009000003002809000001003209000002003A0900000300B70500000400140900000500040900000100B705000002001409000001001D09000002002009000003002809000001004609000001001D09000002002009000003002809000004002403000001003E03000001001D09000002002009000003002809000004003E03000005002403000001001D09000002002009000003002809000004003E03000005002403000001001D09000002002009000003002809000004003E03000005002403000001001D09000002002009000003002809000004002403000001005309000001005309000001005809000002005A09000001006709000001005809000002005A09000001003209000002003A0900000300B705000004001409000005004B02000001006909000002007209000003007A09000001008509000002000C0600000300FA0800000400920900000500A009000001000506000002000C0600000100AB0900000100B90900000200CC0900000100CE08000001005809000001001A0D000001001A0D000001001A0D000001001A0D000001001A0D0E0006000E0011000E0075000F0006000F0011000F00750010000600100011001000750011000600110011001100750012000600120011001200750041001C02AF0149001C02AF0151001C02530259001C02530261001C02530269001C02530271001C02530279001C02530281001C02530289001C02530291001C02A70299001C025302A1001C025302A9001C02AC02B9001C02B202C9001C02B802D1001C02AF01D9001C02AF0121006E0C92030C00C60C9D0321007402AF01E900120DAF012100C60C9903F1001C02AF0111011C02BE03F900540FD003F900630FE30349018E0FED0351011C02AF0159011C02AF0109001C02AF010900D804640209014410140409014F10180461015E101D0409016610220409017010640269017A10280409018B1022047101A9102D0409010D11400409011911450481014011510489015511570491016E115E0429001C02530231001C02AF0199011C025302990144109E04F900540FA204F900630FA80449011812AF0431001D12B80431004410140431002412B80209011313CC0431008B10D304A1011C02DF0409011911E604B901D804640209011313F004C1011C025302C9011C02530209018B10110531001C02B802490176132005D1011C02AF01D9011C02AF0108002C00E60108003000EB0108003400F00108003800F50108003C00FA0108004000FF010800440004020800CC00E6010800D000EB01200093005F0327002302EB012E00430066052E005B0051052E006B0087052E002B0051052E004B0051052E007B00CF052E008300D8052E008B00E1052E00330057052E003B0039052E001B0039052E0023005105400093005F03C0019300EB01C3011B02EB01E00193006D04E3011B02EB0103021B02EB01200293006D0423021B02EB0143021B02EB01040313009402C40313009402E40313009402A40413009402C40413009402E40413009402040513009402C40513009402E40513009402040613009402240613009402440613009402640613009402840613009402A40613009402C006EB00EB01E006EB00EB012007EB00EB014007EB00EB01640713009402840713009402A40713009402C007EB00EB01C40713009402E007EB00EB01E407130094020408130094022008EB00EB012408130094024008EB00EB01440813009402640813009402840813009402A008EB00EB01A40813009402C008EB00EB01C40813009402E408130094020009EB00EB010409130094022009EB00EB012409130094024409130094028009EB00EB01A009EB00EB01E009EB00EB01000AEB00EB01040A13009402240A13009402440A13009402640A13009402800AEB00EB01840A13009402A00AEB00EB01A40A13009402C40A13009402E00AEB00EB01E40A13009402000BEB00EB01040B13009402240B13009402440B13009402640B13009402840B13009402A40B13009402C40B13009402E40B13009402040C13009402240C13009402440C13009402640C13009402840C13009402A40C13009402C40C13009402E40C13009402040D13009402240D13009402440D13009402640D13009402840D13009402A40D13009402C40D13009402E40D13009402A40E13009402C40E13009402E40E13009402040F13009402240F13009402440F13009402640F13009402840F13009402A40F13009402C40F13009402E40F13009402041013009402241013009402441013009402641013009402841013009402A41013009402C41013009402E41013009402041113009402241113009402441113009402641113009402841113009402A41113009402C41113009402E41113009402041213009402241213009402441213009402641213009402841213009402A41213009402C41213009402E41213009402041313009402241313009402441313009402641313009402841313009402A41313009402C41313009402E41313009402041413009402241413009402441413009402641413009402841413009402A41413009402C41413009402E41413009402041513009402241513009402441513009402641513009402841513009402A41513009402C41513009402E41513009402041613009402241613009402441613009402641613009402841613009402080006000006B301BE018703FC03010406040B0437043B044C046504BE04C304DA04F604010506050C0516051A05250535050E0001000F0003001000050011000700120009000000780EBA030000B60EBA030000780EBA030000B60EBA030000780EBA030000B60EBA030000780EBA030000B60EBA030000780EBA030000B60EBA0302003600030002003900050002003E000700020041000900020045000B00020048000D0002004C000F0002004F0011000200540013000200570015000E006A0027000E006C0029000E006E002B000E0070002D000E0072002F000F007A0027000F007C0029000F007E002B000F0080002D000F0082002F0010008C002B0010008A00290010008800270010008E002D00100090002F0011009A002B0011009800290011009600270011009C002D0011009E002F001200A60027001200A80029001200AA002B001200AC002D001200AE002F008C0304800000010000003E10396B01000000BD02FD0B00000400000000000000000000000100B300000000000400000000000000000000000100B701000000000400000000000000000000000100E10400000000030002000400020005000400060002000700060008000600090002000A0002000B0002000C0002000D0002000E0002000F0002001000020011000200120002003900F8036900F8030000003C4D6F64756C653E00586D6C417352656C6174696F6E616C5476662E646C6C0067627200526573756C74526F770058526F770058526F7746696E64537461746500586D6C526F770046696E6453706563696669635461670046696E64416E7954616700586D6C526F774D656D4D61707065640046696C6552656164506F736974696F6E0046696C65506172745F526F770046696C65506172745F46696E640046696C65506172745F46696E645374617465006D73636F726C69620053797374656D004F626A6563740056616C75655479706500456E756D0053797374656D2E436F6C6C656374696F6E730049456E756D657261746F7200476574586D6C5461677300476574586D6C546167735F536C69636500476574546167735F536C69636500476574546167735F46696C6C3100476574546167735F46696C6C3200476574546167735F46696C6C3400476574546167735F46696C6C3800476574546167735F46696C6C313600476574546167735F46696C6C333200476574546167735F46696C6C36340047657446696C657346726F6D46696C7465720047657446696C657346726F6D46696C657370656300486173685F36340053797374656D2E446174610053797374656D2E446174612E53716C54797065730053716C537472696E670048656C6C6F466E0047657446696C65506172740047657446696C65506172745F46696C6C0047657446696C65506172745F456D626564646564002E63746F7200504B0053797374656D2E5465787400537472696E674275696C6465720073620046696C654E616D65004D6178436F6C756D6E436F756E740046696C65506F736974696F6E0046696C654E616D654861736800526573657400726573756C74526F770069436F6C756D6E436F756E740046696E644E6578740076616C75655F5F00586D6C526F7746696E64526F77537461727454616700586D6C526F7746696E64436F6C54616700586D6C526F77536B6970436F6C54616700586D6C526F7753617665436F6C54616700586D6C526F77536B6970526573744F66456E6454616700586D6C526F77466F756E64526F77004D41585F5441474E414D455F4C454E4754480066696E6453746174650066696E64526F770066696E64436F6C0063757272656E745461670053657446696E6453746174650046696E64526F7753746172745461675F624861734E6F456E645461670046696E64526F77537461727454616700476574436F6C756D6E496E646578466F725461670046696E64436F6C5461675F62466F756E645461670046696E64436F6C5461675F62466F756E64526F77456E645461670046696E64436F6C5461675F624861734E6F456E645461674F724973456E645461670046696E64436F6C54616700536B6970436F6C5461675F635072657600536B6970436F6C5461670053617665436F6C5461675F63507265760053617665436F6C54616700536B6970526573744F66456E64546167006261546167546F46696E6400695461675F4C656E67746800695461675F466F756E640069456E645461675F466F756E640062536B69705468655265737400536574546167005265736574466F756E6400466F756E64537461727454616700466F756E64456E64546167006261546167466F756E640062536B697070696E67526573740069546167496E6465780046696E64537461727454616700546F537472696E670053797374656D2E436F72650053797374656D2E494F2E4D656D6F72794D617070656446696C6573004D656D6F72794D6170706564566965774163636573736F7200536C696365537461727400536C696365456E64656400536C6963654C656E6774680046696C6553697A65004275666665724D61704C656E677468004275666665724C656E67746800536C696365536B6970526573740069536C69636530426173656400476574536C696365537461727456616C7565004765744D617042756666657253697A650047657442756666657253697A6500706B0073747200466F756E6400626146696E64006946696E640069466F756E640046696E6453746172740046696E64456E640066696C655370656300726F7774616700636F6C756D6E746167730069536C6963650069536C696365436F756E74006942756666657253697A65006C4275666665724D617053697A650078526F7700726F775F726177006F69504B0053797374656D2E52756E74696D652E496E7465726F705365727669636573004F7574417474726962757465006F7346696C654E616D65006F6946696C656E616D6548617368006F6946696C65506F736974696F6E006F73436F6C3030004D6963726F736F66742E53716C5365727665722E5365727665720053716C4661636574417474726962757465006F73436F6C3031006F73436F6C3032006F73436F6C3033006F73436F6C3034006F73436F6C3035006F73436F6C3036006F73436F6C3037006F73436F6C3038006F73436F6C3039006F73436F6C3130006F73436F6C3131006F73436F6C3132006F73436F6C3133006F73436F6C3134006F73436F6C3135006F73436F6C3136006F73436F6C3137006F73436F6C3138006F73436F6C3139006F73436F6C3230006F73436F6C3231006F73436F6C3232006F73436F6C3233006F73436F6C3234006F73436F6C3235006F73436F6C3236006F73436F6C3237006F73436F6C3238006F73436F6C3239006F73436F6C3330006F73436F6C3331006F73436F6C3332006F73436F6C3333006F73436F6C3334006F73436F6C3335006F73436F6C3336006F73436F6C3337006F73436F6C3338006F73436F6C3339006F73436F6C3430006F73436F6C3431006F73436F6C3432006F73436F6C3433006F73436F6C3434006F73436F6C3435006F73436F6C3436006F73436F6C3437006F73436F6C3438006F73436F6C3439006F73436F6C3530006F73436F6C3531006F73436F6C3532006F73436F6C3533006F73436F6C3534006F73436F6C3535006F73436F6C3536006F73436F6C3537006F73436F6C3538006F73436F6C3539006F73436F6C3630006F73436F6C3631006F73436F6C3632006F73436F6C36330066696C746572007300666E006F6666736574006C656E677468006275666665724C656E67746800726F77007461670069506B007346696C654E616D6500694D6178436F6C756D6E436F756E740066696C654E616D650062610069427566666572006C656E4275666665720073526F775461670073436F6C756D6E54616773006E657746696E6453746174650073546167006200624861734E6F456E645461670070006163636573736F72006C427566666572006C4C656E4275666665720069536C696365314261736564006C4275666665724D61704C656E006C4275666665724C656E006C4D6170506F73496E46696C65006C4D617042756666657253697A655F557365006C4D656D6F7279506F73496E4D61700053797374656D2E5265666C656374696F6E00417373656D626C795469746C6541747472696275746500417373656D626C794465736372697074696F6E41747472696275746500417373656D626C79436F6E66696775726174696F6E41747472696275746500417373656D626C79436F6D70616E7941747472696275746500417373656D626C7950726F6475637441747472696275746500417373656D626C79436F7079726967687441747472696275746500417373656D626C7954726164656D61726B41747472696275746500417373656D626C7943756C7475726541747472696275746500436F6D56697369626C6541747472696275746500417373656D626C7956657273696F6E4174747269627574650053797374656D2E52756E74696D652E56657273696F6E696E67005461726765744672616D65776F726B4174747269627574650053797374656D2E53656375726974792E5065726D697373696F6E730053656375726974795065726D697373696F6E417474726962757465005365637572697479416374696F6E0053797374656D2E446961676E6F73746963730044656275676761626C6541747472696275746500446562756767696E674D6F6465730053797374656D2E52756E74696D652E436F6D70696C6572536572766963657300436F6D70696C6174696F6E52656C61786174696F6E734174747269627574650052756E74696D65436F6D7061746962696C69747941747472696275746500586D6C417352656C6174696F6E616C5476660053716C46756E6374696F6E417474726962757465003C476574546167735F536C6963653E645F5F300053797374656D2E436F6C6C656374696F6E732E47656E657269630049456E756D657261746F7260310049446973706F7361626C65004D6F76654E657874003C3E325F5F63757272656E740053797374656D2E436F6C6C656374696F6E732E47656E657269632E49456E756D657261746F723C53797374656D2E4F626A6563743E2E6765745F43757272656E74006765745F43757272656E740053797374656D2E436F6C6C656374696F6E732E49456E756D657261746F722E52657365740053797374656D2E49446973706F7361626C652E446973706F736500446973706F7365003C3E315F5F73746174650053797374656D2E436F6C6C656374696F6E732E49456E756D657261746F722E6765745F43757272656E74003C62613E355F5F31003C6546696C653E355F5F32003C666E3E355F5F33003C66696C6552656164506F736974696F6E3E355F5F34003C726F7746696E6453746174653E355F5F35004D656D6F72794D617070656446696C655365637572697479003C6D656D6F72794D617070656446696C6553656375726974793E355F5F36004D656D6F72794D617070656446696C65003C6D6D663E355F5F37003C6C4D6170506F73496E46696C653E355F5F38003C6C4D617042756666657253697A655F5573653E355F5F39003C6163636573736F723E355F5F61003C6C4D656D6F7279506F73496E4D61703E355F5F62003C694275666665724C656E3E355F5F63003C694275666665723E355F5F64003C3E6D5F5F46696E616C6C7965003C3E6D5F5F46696E616C6C79660053797374656D2E436F6C6C656374696F6E732E47656E657269632E49456E756D657261746F723C53797374656D2E4F626A6563743E2E43757272656E740053797374656D2E436F6C6C656374696F6E732E49456E756D657261746F722E43757272656E74004279746500537472696E670053797374656D2E494F0046696C6553747265616D0046696C654D6F64650046696C654163636573730046696C6553686172650046696C654F7074696F6E73004D656D6F72794D617070656446696C654163636573730048616E646C65496E68657269746162696C6974790043726561746546726F6D46696C6500437265617465566965774163636573736F7200556E6D616E616765644D656D6F72794163636573736F720052656164417272617900446562756767657248696464656E417474726962757465004E6F74537570706F72746564457863657074696F6E003C47657446696C657346726F6D46696C7465723E645F5F3131003C62526563757273653E355F5F3132003C73506174683E355F5F3133003C735365617263683E355F5F3134003C7346696C654E616D653E355F5F3135003C3E6D5F5F46696E616C6C793136003C3E375F5F777261703137003C3E375F5F777261703138006765745F4C656E677468006765745F4368617273004368617200546F557070657200537562737472696E67005472696D0050617468004765744469726563746F72794E616D650052656D6F7665004469726563746F7279005365617263684F7074696F6E0047657446696C6573003C47657446696C657346726F6D46696C65737065633E645F5F3161003C7346696C7465723E355F5F3162003C693E355F5F3163003C3E6D5F5F46696E616C6C793164003C3E375F5F777261703165003C3E375F5F77726170316600546F4368617241727261790053706C69740053797374656D2E53656375726974792E43727970746F677261706879004D4435004372656174650048617368416C676F726974686D00436F6D707574654861736800426974436F6E76657274657200546F496E743634003C47657446696C65506172743E645F5F3231003C726F773E355F5F3232003C6C4C6F63616C53746172743E355F5F3233003C6C456E643E355F5F3234003C6D6D663E355F5F3235003C6C4C6F63616C456E643E355F5F3236003C6163636573736F723E355F5F3237003C623E355F5F3238003C693E355F5F3239003C3E6D5F5F46696E616C6C793261003C3E6D5F5F46696E616C6C7932620046696C65496E666F005265616400417070656E64007365745F4C656E677468003C47657446696C65506172745F456D6265646465643E645F5F3264003C6C42756666657253697A653E355F5F3265003C726F773E355F5F3266003C73746174653E355F5F3330003C66426567696E3E355F5F3331003C66456E643E355F5F3332003C6C46696C6553697A653E355F5F3333003C6D6D663E355F5F3334003C6C46696C65506F733E355F5F3335003C6C42756666657253697A655F5573653E355F5F3336003C6163636573736F723E355F5F3337003C623E355F5F3338003C693E355F5F3339003C3E6D5F5F46696E616C6C793361003C3E6D5F5F46696E616C6C79336200436F6E636174005374727563744C61796F7574417474726962757465004C61796F75744B696E6400537472696E6753706C69744F7074696F6E7300496E74333200457863657074696F6E004E6F74496D706C656D656E746564457863657074696F6E00526561644279746500436F6D70696C657247656E6572617465644174747269627574650053797374656D2E536563757269747900556E76657269666961626C65436F64654174747269627574650000037C00000B480065006C006C006F0000033C0000033E0000053C002F00002B43006F006C0075006D006E00200063006F0075006E0074002000650078006300650065006400730020000023460069006E00640053007400610074006500200075006E006B006E006F0077006E00000F3C0065006D007000740079003E00002553006C0069006300650020006F007500740020006F0066002000720061006E006700650000000000A2A301ED0AE4314D8FE191CD3EEBCCF90008B77A5C561934E08907000312110E0E0E0B000712110E0E0E0808080A0D000812110E0E0E0808080A12100E0006011C100A100E100A100A100E100007011C100A100E100A100A100E100E140009011C100A100E100A100A100E100E100E100E1C000D011C100A100E100A100A100E100E100E100E100E100E100E100E2C0015011C100A100E100A100A100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E4C0025011C100A100E100A100A100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E808C0045011C100A100E100A100A100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E100E05000112110E0400010A0E040000111508000412110E0A0A0A080003011C100A100E06000212110E0E0320000102060A04061D121902060E020608062003010A0E08042001010A052002010A0E0306110C0A20031114101D051008080306111404000000000401000000040200000004030000000404000000040500000004000100000306111C04061D111C03061220082005010E0E0A0E080520010111140206020C200401101D05100808101114062001021012200F200501101D0510080810122010111402060303061D05042001010E0620020205100204200102050320000E0920031114121D100A0A0820050108080E0A080520020A08080420010A0A052002080A0A030612190306113412010001005408074D617853697A65FFFFFFFF0420010102052001011159052001011161042001010880A000240000048000009400000006020000002400005253413100040000010001001FA9DDE0E2AD32A82B062AD40D4A3E8F5901039158BFD5AC46220EC659FC6D55195A448989B4FA59039D97466BE8C3C7C9293314B2F1240C0A1B8FC42237633B5757DBF2878F90F20CB1987BFDCE5A9B58FE4F762DBF1A0EB1D56EC2BED5597292E595F38C4210FF06243926CADF732546E04CB766BD8A5F9A71654F1FBCFAEB2701000100540E1146696C6C526F774D6574686F644E616D650E476574546167735F46696C6C3332040701121805151271011C0320000202061C0320001C0420001300030612100306121103061228030612790306127D0306121D0328001C112006010E11808D11809111809508118099120007127D1280890E0A11809D12791180A102092003121D0A0A11809D0A300104080A1D1E000808030A0105040702020804070208080407011238040701110C03061D0E03200008042001030804000103030520020E08080400010E0E0900031D0E0E0E1180BD03070108040701123C0420001D030620011D0E1D0304070112400500001280C10620011D051D050600020A1D05080707031D05081D052901000100540E1146696C6C526F774D6574686F644E616D651047657446696C65506172745F46696C6C0306112C0206050320000A050001127D0E062002121D0A0A08300102010A101E000520011219030407011244040701112C030611300600030E0E0E0E062002121908080407011248062001011180D50920021D0E1D0E1180D90500020E0E0E0A07060E0E1D0E1D0E0808040701111405070308020804070203080420010E0803070102050702121908042001050A0F070C0302020202030311140A0A0A0A0307010A17010012586D6C417352656C6174696F6E616C54766600000501000000000E0100094D6963726F736F667400002001001B436F7079726967687420C2A9204D6963726F736F6674203230313100004701001A2E4E45544672616D65776F726B2C56657273696F6E3D76342E300100540E144672616D65776F726B446973706C61794E616D65102E4E4554204672616D65776F726B20340801000300000000000801000800000000001E01000100540216577261704E6F6E457863657074696F6E5468726F777301809E2E01808453797374656D2E53656375726974792E5065726D697373696F6E732E53656375726974795065726D697373696F6E4174747269627574652C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038391501540210536B6970566572696669636174696F6E0100000000E3C8D74D000000000200000079000000487D0000485F00005253445390CAED115459A04685F9600BF285F4E80B000000433A5C446F635C74667330372E636F6465706C65782E636F6D5C586D6C417352656C6174696F6E616C5476665C586D6C417352656C6174696F6E616C5476665C6F626A5C44656275675C586D6C417352656C6174696F6E616C5476662E70646200000000EC7D000000000000000000000E7E0000002000000000000000000000000000000000000000000000007E00000000000000000000000000000000000000005F436F72446C6C4D61696E006D73636F7265652E646C6C0000000000FF2500204000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100100000001800008000000000000000000000000000000100010000003000008000000000000000000000000000000100000000004800000058800000780300000000000000000000780334000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE0000010000000100396B3E1000000100396B3E103F000000000000000400000002000000000000000000000000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E0073006C006100740069006F006E00000000000000B004D8020000010053007400720069006E006700460069006C00650049006E0066006F000000B4020000010030003000300030003000340062003000000034000A00010043006F006D00700061006E0079004E0061006D006500000000004D006900630072006F0073006F00660074000000500013000100460069006C0065004400650073006300720069007000740069006F006E000000000058006D006C0041007300520065006C006100740069006F006E0061006C005400760066000000000040000F000100460069006C006500560065007200730069006F006E000000000031002E0030002E0034003100350038002E00320037003400340039000000000050001700010049006E007400650072006E0061006C004E0061006D006500000058006D006C0041007300520065006C006100740069006F006E0061006C005400760066002E0064006C006C00000000005C001B0001004C006500670061006C0043006F007000790072006900670068007400000043006F0070007900720069006700680074002000A90020004D006900630072006F0073006F006600740020003200300031003100000000005800170001004F0072006900670069006E0061006C00460069006C0065006E0061006D006500000058006D006C0041007300520065006C006100740069006F006E0061006C005400760066002E0064006C006C0000000000480013000100500072006F0064007500630074004E0061006D0065000000000058006D006C0041007300520065006C006100740069006F006E0061006C005400760066000000000044000F000100500072006F006400750063007400560065007200730069006F006E00000031002E0030002E0034003100350038002E00320037003400340039000000000048000F00010041007300730065006D0062006C0079002000560065007200730069006F006E00000031002E0030002E0034003100350038002E003200370034003400390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007000000C000000203E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
	WITH PERMISSION_SET = UNSAFE'
EXEC Ex 1,0,'CREATE FUNCTION dbo.GetXmlTags_Slice(@fn NVARCHAR(4000), @rowtag NVARCHAR(4000), @colmuntagsPiped NVARCHAR(4000), @iSlice INT, @iSliceCount INT, @iBufferSize INT, @lBufferMapSize BIGINT)
	RETURNS TABLE (PK BIGINT, fileName NVARCHAR(4000), fileNameHash BIGINT, FilePosition BIGINT,
	osCol00 NVARCHAR(4000), osCol01 NVARCHAR(MAX), osCol02 NVARCHAR(4000), osCol03 NVARCHAR(4000), osCol04 NVARCHAR(4000), osCol05 NVARCHAR(4000), osCol06 NVARCHAR(4000), osCol07 NVARCHAR(4000), osCol08 NVARCHAR(4000), osCol09 NVARCHAR(4000),
	osCol10 NVARCHAR(4000), osCol11 NVARCHAR(4000), osCol12 NVARCHAR(4000), osCol13 NVARCHAR(4000), osCol14 NVARCHAR(4000), osCol15 NVARCHAR(4000), osCol16 NVARCHAR(4000), osCol17 NVARCHAR(4000), osCol18 NVARCHAR(4000), osCol19 NVARCHAR(4000),
	osCol20 NVARCHAR(4000), osCol21 NVARCHAR(4000), osCol22 NVARCHAR(4000), osCol23 NVARCHAR(4000), osCol24 NVARCHAR(4000), osCol25 NVARCHAR(4000), osCol26 NVARCHAR(4000), osCol27 NVARCHAR(4000), osCol28 NVARCHAR(4000), osCol29 NVARCHAR(4000),
	osCol30 NVARCHAR(4000), osCol31 NVARCHAR(4000)) EXTERNAL NAME XmlAsRelationalTvf.gbr.GetXmlTags_Slice'
---------------------------------------- Wikipedia ----------------------------------------
EXEC Ex 1,0,'CREATE SCHEMA Wikipedia'
EXEC Ex 1,0,'DROP PROC Wikipedia.Configure'
EXEC Ex 1,0,'DROP PROC Wikipedia.UncompressFiles'
EXEC Ex 1,0,'DROP PROC Wikipedia.AddUncompressedFiles'
EXEC Ex 1,0,'DROP PROC Wikipedia.ImportUncompressedFiles'
EXEC Ex 1,0,'DROP TABLE Wikipedia.Article'
EXEC Ex 1,0,'DROP TABLE Wikipedia.Wiki'
GO
CREATE TABLE Wikipedia.Wiki(PK_Wiki BIGINT NOT NULL PRIMARY KEY CLUSTERED, Wiki SYSNAME, FileName NVARCHAR(4000), ts DATETIME NOT NULL DEFAULT GETDATE())
GO
CREATE TABLE Wikipedia.Article(PK_Article BIGINT NOT NULL PRIMARY KEY CLUSTERED, FK_Wiki BIGINT NOT NULL, title VARCHAR(4000) NOT NULL, content VARCHAR(MAX) NOT NULL, FilePosition BIGINT, FileSlize INT, ts DATETIME NOT NULL DEFAULT GETDATE())
GO
CREATE PROC Wikipedia.Configure @folder NVARCHAR(4000)='C:\BigLink_wikipedia\'
	,@winrar NVARCHAR(4000)='"C:\Program Files\WinRAR\WINRAR.exe" e -y'
AS -- Wikipedia settings
	DECLARE @cmd NVARCHAR(4000)
	DELETE FROM setting WHERE name LIKE 'Wikipedia %'
	EXEC SetSetting 'Wikipedia prereq','.bz2-files ready in folder'
	EXEC SetSetting 'Wikipedia folder',@folder
	EXEC SetSetting 'Wikipedia rar command',@winrar
	SET @cmd='cmd /Cmd '+dbo.Get('Wikipedia folder') --Create folder "I:\data\BigLink\wikipedia\"		md I:\data\BigLink\wikipedia
	DELETE FROM cmds WHERE comment='Wikipedia create folder'
	EXEC ExCmd 'Wikipedia create folder',@cmd
	SELECT * FROM cmds WHERE comment='Wikipedia create folder'
GO
CREATE PROC Wikipedia.UncompressFiles @filter SYSNAME='*.bz2'
AS -- List files
	DELETE FROM cmds WHERE comment LIKE 'Wikipedia compressed file'
	DECLARE @cmd NVARCHAR(4000)='cmd /Cdir /b '+dbo.Get('Wikipedia folder')+@filter
	EXEC ExCmd 'Wikipedia compressed file',@cmd
	DECLARE @rowCount SYSNAME=@@ROWCOUNT
	DELETE FROM cmds WHERE comment='Wikipedia compressed file' AND output='File not found'
	IF @@ROWCOUNT=1
	BEGIN
		PRINT 'No files found'
		RETURN -1
	END
-- Loop files for uncompress
	DECLARE @nextFile SYSNAME
	SELECT TOP 1 @nextFile=output FROM cmds WHERE comment='Wikipedia compressed file'
	WHILE @nextFile IS NOT NULL
	BEGIN -- Decompress
		DECLARE @cmdComment NVARCHAR(4000)='Wikipedia rar:'+@nextFile
		SET @cmd=dbo.Get('Wikipedia rar command')+' '+dbo.Get('Wikipedia folder')+@nextFile+' '+dbo.Get('Wikipedia folder')
		SELECT comment=@cmdComment, cmd=@cmd
		EXEC ExCmd @cmdComment, @cmd
		-- Delete archive
		SET @cmdComment='Wikipedia delete compressed:'+@nextFile
		SET @cmd='echo y|del '+dbo.Get('Wikipedia folder')+@nextFile
		SELECT comment=@cmdComment, cmd=@cmd
		EXEC ExCmd @cmdComment, @cmd
		-- Signal XML file ready to import 
		UPDATE cmds SET comment='Wikipedia XML file' ,output=LEFT(output,LEN(output)-4),dt=GETDATE()
			WHERE comment='Wikipedia compressed file' AND output=@nextFile
		-- Grab next file
		SELECT TOP 1 @nextFile=output FROM cmds WHERE comment='Wikipedia compressed file'
		IF @@ROWCOUNT=0 
			SET @nextFile=NULL -- The end
	END
	RETURN 0
GO
CREATE PROC Wikipedia.AddUncompressedFiles @filter SYSNAME='*.xml'
AS -- List files
	DELETE FROM cmds WHERE comment LIKE 'Wikipedia compressed file'
	DECLARE @cmd NVARCHAR(4000)='cmd /Cdir /b '+dbo.Get('Wikipedia folder')+@filter
	EXEC ExCmd 'Wikipedia XML file',@cmd
	RETURN 0
GO
CREATE PROC Wikipedia.ImportUncompressedFiles
AS -- Loop files for import
	DECLARE @nextFile SYSNAME
	SELECT TOP 1 @nextFile=output FROM cmds WHERE comment='Wikipedia XML file'
	WHILE @nextFile IS NOT NULL
	BEGIN -- Import (partition swapping would be better for Article? :))
		DECLARE @wikiEnd INT=LEN(@nextFile)-CHARINDEX('-ikiw',REVERSE(@nextFile))-4
		DECLARE @Wiki NVARCHAR(4000)=SUBSTRING(@nextFile,1, @wikiEnd)
		DECLARE @FK_Wiki BIGINT=CAST(CAST(CAST(SUBSTRING(@Wiki,1,8) AS CHAR(8)) AS VARBINARY) AS BIGINT)
		DECLARE @fileName NVARCHAR(4000)=dbo.Get('Wikipedia folder')+@nextFile
		PRINT '-- -- '+@fileName
		PRINT '-- Update "Wiki" first, ' + @fileName
		UPDATE Wikipedia.Wiki SET FileName=@fileName, ts=GETDATE() 
			WHERE PK_Wiki=@FK_Wiki
		IF @@ROWCOUNT=0
			INSERT Wikipedia.Wiki VALUES (@FK_Wiki, @Wiki, @fileName, GETDATE())
		PRINT '-- Delete old articles'
		BEGIN TRANSACTION
			DELETE FROM Wikipedia.Article WHERE FK_Wiki=@FK_Wiki -- AND FileSlice=@i
		COMMIT
		DECLARE @i INT=1--LOOP 1 to 100
		WHILE @i<=100
		BEGIN
			BEGIN TRANSACTION
			PRINT '-- '+@fileName+':'+CAST(FLOOR((@i*100)/100) AS SYSNAME)+'%'
			;WITH r AS (SELECT * FROM GetXmlTags_Slice(@fileName, 'page', 'title|text', @i, 100, 65536, 1048576))
				INSERT Wikipedia.Article
				SELECT PK_Article=@FK_Wiki^(@i+PK*100),@FK_Wiki,title=osCol00,content=osCol01,FilePosition,@i,GETDATE() FROM r
			COMMIT
			SET @i=@i+1
		END
		-- Signal XML file imported
		UPDATE cmds SET comment='Wikipedia file imported' ,output=LEFT(output,LEN(output)-4),dt=GETDATE()
			WHERE comment='Wikipedia XML file' AND output=@nextFile
		-- Grab next file
		SELECT TOP 1 @nextFile=output FROM cmds WHERE comment='Wikipedia XML file'
		IF @@ROWCOUNT=0 
			SET @nextFile=NULL -- The end
	END
	RETURN 0
GO
-- Init
EXEC Wikipedia.Configure 'C:\_play\BigLink\wikipedia\','"c:\Program Files\WinRAR\WinRAR.exe" e -y'
-- Import
-- -- Download to F:\Doc_Play\Data\BigLink\wikipedia\ no bi da no en http://dumps.wikimedia.org/nowiki/latest/nowiki-latest-pages-articles.xml.bz2
--Compressed files
--EXEC Wikipedia.UncompressFiles '*.bz2'
--EXEC Wikipedia.ImportUncompressedFiles

--Whan we already have the XML
EXEC Wikipedia.AddUncompressedFiles 'no*.xml'
--EXEC Wikipedia.ImportUncompressedFiles
dbcc shrinkdatabase('BigLink')

--SELECT TOP 100 * FROM Wikipedia.Wiki
--SELECT TOP 100 * FROM Wikipedia.Wiki JOIN Wikipedia.Article ON PK_Wiki=FK_Wiki
--SELECT DISTINCT FK_Wiki FROM Wikipedia.Article 
--SELECT COUNT(*) FROM Wikipedia.Wiki
--SELECT COUNT(*) FROM Wikipedia.Article
SELECT * FROM cmds
GO
---------------------------------------- Tests ----------------------------------------
--*/
--truncate table wikipedia.article
USE BigLink
GO
--SELECT * FROM GetXmlTags_Slice('C:\_play\BigLink\wikipedia\nowiki-latest-pages-articles.xml', 'page', 'title|text', 1, 100, 65536, 1048576)
GO
PRINT 'Create table test_wikipedia'
;WITH r AS (SELECT * FROM GetXmlTags_Slice('C:\_play\BigLink\wikipedia\nowiki-latest-pages-articles.xml', 'page', 'title|text', 1, 100, 65536, 1048576)
) SELECT TOP 0 title=osCol00,content=osCol01,FilePosition,FromDate=GETDATE(),ToDate=CAST(NULL AS DATETIME) INTO test_wikipedia /*DROP TABLE test_wikipedia*/ FROM r
GO
--PRINT 'Fill table test_wikipedia 1/100'
--;WITH r AS (SELECT * FROM GetXmlTags_Slice('C:\_play\BigLink\wikipedia\nowiki-latest-pages-articles.xml', 'page', 'title|text', 1, 100, 65536, 1048576)
--) INSERT test_wikipedia SELECT title=osCol00,content=osCol01,FilePosition,FromDate=GETDATE(),ToDate=CAST(NULL AS DATETIME) FROM r
GO
--PRINT 'Fill table test_wikipedia 2/100'
--;WITH r AS (SELECT * FROM GetXmlTags_Slice('C:\_play\BigLink\wikipedia\nowiki-latest-pages-articles.xml', 'page', 'title|text', 2, 100, 65536, 1048576)
--) INSERT test_wikipedia SELECT title=osCol00,content=osCol01,FilePosition,FromDate=GETDATE(),ToDate=CAST(NULL AS DATETIME) FROM r
GO
--;WITH t10 AS (SELECT TOP 10 l=LEN(content), title FROM test_wikipedia ORDER BY LEN(content) DESC) SELECT * FROM t10
--SELECT * FROM test_wikipedia WHERE title='Sveriges byer'
GO

